{extend name="index/base" /}
{block name='title'}Change Password{/block}
{block name='content'}

<div class="container clearfix my-5 pb-1">
    {include file="user/leftMenu" name="MY ACCOUNT" route="user/password"/}

    <div class="userBox">
        <h4 class="title cleafix">
            Change Password
        </h4>

        <div class="changepass js_editBox">
            <form name="formPassword" action="" id="modpassword" class="userform" method="post" novalidate="novalidate">
                <ul class="i_table">
                    <li>
                        <p class="fl i_table_l"><strong class="pink fb">*</strong>Old Password:</p>
                        <div class="fl i_table_r">
                            <input id="old_password" type="password" v-model="old_password" class="inputText i_table_w150" size="25" value=""
                                maxlength="60">
                        </div>
                    </li>
                    <li class="clearfix notice-fix">
                        <p class="fl i_table_l"><strong class="pink fb">*</strong>New Password:</p>
                        <div class="fl i_table_r pr">
                            <!-- <div class="notice-pass info-icon">
                            <div class="text"> Password length should not be less than 8 characters,it need to include letters and numbers.It is recommended that please do not use the same password as other websites.</div>
                        </div>  -->
                            <input id="new_password" type="password" v-model="password" class="inputText i_table_w150" value="" size="25"
                                maxlength="40">
                        </div>
                    </li>
                    <li>
                        <p class="fl i_table_l"><strong class="pink fb">*</strong>Confirm Password:</p>
                        <div class="fl i_table_r">
                            <input name="comfirm_password" id="comfirm_password" v-model="re_password" type="password" size="25"
                                class="inputText i_table_w150" maxlength="40">
                        </div>
                    </li>
                    <li>
                        <p class="fl i_table_l">&nbsp;</p>
                        <div class="fl i_table_r">
                            <button type="button" class="userRedBtn" title="Submit" @click="submit">Confirm Edit</button>
                        </div>
                    </li>
                </ul>
            </form>

        </div>
    </div>
</div>

{/block}
{block name='script'}

<script>

    layui.extend({
    }).use([], function () {
        initVue({
            data: {
                old_password: '',
                password: '',
                re_password: '',
            },
            components: {

            },
            computed: {

            },
            created: function () {
            },
            mounted: function () {
            },
            methods: {
                submit:function(){
                    if(this.password!==this.re_password){
                        this.$message.error("{:lang('err_password_yz')}")
                        return
                    }

                    const that = this
                    this.$network('user/modPwd',{
                        old_password : this.old_password,
                        password : this.password,
                    }).then(function(res){
                        const data = res.data||{}
                        that.$message.success(res.msg)
                    }).catch(function(err){
                        console.error('---err',err)
                    })
                }
            },
        })


    })

</script>

{/block}